From: Carlos Garnacho Date: Wed, 12 Jul 2017 20:38:31 +0000 (+0200) Subject: padOsd: strengthen ring/strip label creation X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~251 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0d0e90ce9a75899348c231618415868248f383fa;p=gnome-shell.git padOsd: strengthen ring/strip label creation If the padOsd is given a nonexistent ring/strip, things would fail badly later when trying to paint a 0x0 StLabel. Just avoid creating more ring/strip labels than those known by libwacom. This is unlikely to happen, but seems better to protect against it. https://bugzilla.gnome.org/show_bug.cgi?id=782033 --- diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js index bdc381f9d..7358b00fb 100644 --- a/js/ui/padOsd.js +++ b/js/ui/padOsd.js @@ -685,11 +685,17 @@ const PadOsd = new Lang.Class({ } for (i = 0; i < padDevice.get_n_rings(); i++) { + let [found] = this._padDiagram.getRingLabelCoords(i, CW); + if (!found) + break; this._createLabel(Meta.PadActionType.RING, i, CW); this._createLabel(Meta.PadActionType.RING, i, CCW); } for (i = 0; i < padDevice.get_n_strips(); i++) { + let [found] = this._padDiagram.getStripLabelCoords(i, UP); + if (!found) + break; this._createLabel(Meta.PadActionType.STRIP, i, UP); this._createLabel(Meta.PadActionType.STRIP, i, DOWN); }